package com.corgi.mybatis.modules.controller;

import com.corgi.mybatis.base.PageInfo;
import com.corgi.mybatis.modules.domain.People;
import com.corgi.mybatis.modules.dto.PeopleDto;
import com.corgi.mybatis.modules.mapper.PeopleMapper;
import com.corgi.mybatis.modules.service.PeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @title: PeopleController
 * @description:
 * @author: dengmiao
 * @create: 2019-10-18 11:09
 **/
@RestController
@RequestMapping("people")
public class PeopleController {

    @Autowired
    private PeopleMapper peopleMapper;

    @Autowired
    private PeopleService peopleService;

    @GetMapping("findList")
    public List<People> findList() {
        return peopleMapper.selectList();
    }

    @GetMapping("findPage")
    public PageInfo<People> findPage(PageInfo pageInfo) {
        peopleMapper.selectPageList(pageInfo);
        return pageInfo;
    }

    @GetMapping("findListMapping")
    public List<PeopleDto> findListMapping() {
        return peopleService.findList();
    }
}
